package tour.spring.bc.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import tour.spring.bc.dao.ClientDao;
import tour.spring.bc.model.Client;

@Repository
public class ClientDaoImpl extends AbstractDAOImpl<Client> implements ClientDao {

	public ClientDaoImpl() {
		super(Client.class);
	}
	
	public Client getClientByLogin(String login){
		List<Client> client = loadByNamedParam("from Client c where login = :plogin", "plogin", login);
		if(client.isEmpty()) {
			return null;
		}
		return client.get(0);
	}
	
}
